<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      function Pig(name, age, sex, skill) {
        this.name = name
        this.age = age
        this.sex = sex
        this.skill = skill
      }
      var zhuzhu = new Pig('猪猪', 18, '女', 'say梦话')
      //   alert(zhuzhu.name)
      //   function NongYao(name, type, blood, attack) {
      //     this.name = name
      //     this.type = type
      //     this.blood = blood
      //     this.attack = function (attack) {
      //       alert(`${name}是${attack}英雄`)
      //     }
      //   }
      //   var lianpo = new NongYao('廉颇', '力量型', '500血量', '近战')
      //   var houyi = new NongYao('后羿', '射手型', '100血量', '远程')
      //   houyi.attack('远程')
      for (var k in zhuzhu) {
        console.log(k)
        console.log(zhuzhu[k])
      }
    </script>
  </body>
</html>
